package collections;

public class RedBlackTreeNode<T> {
	private T key;
	private RedBlackTreeColor color;

	private RedBlackTreeNode<T> parent;
	private RedBlackTreeNode<T> leftChild;
	private RedBlackTreeNode<T> rightChild;
	
	public RedBlackTreeNode() {
	}
	
	public RedBlackTreeNode(T key) {
		setKey(key);
	}

	public T getKey() {
		return key;
	}

	public void setKey(T key) {
		this.key = key;
	}

	public RedBlackTreeNode<T> getParent() {
		return parent;
	}
	
	public void setParent(RedBlackTreeNode<T> v) {
		parent = v;
	}

	public RedBlackTreeNode<T> getRightChild() {
		return rightChild;
	}

	public void setRightChild(RedBlackTreeNode<T> rightChild) {
		this.rightChild = rightChild;
		if(rightChild != null)
			rightChild.parent = this;
	}

	public RedBlackTreeNode<T> getLeftChild() {
		return leftChild;
	}

	public void setLeftChild(RedBlackTreeNode<T> leftChild) {
		this.leftChild = leftChild;
		if(leftChild != null)
			leftChild.parent = this;
	}

	public RedBlackTreeColor getColor() {
		return color;
	}

	public void setColor(RedBlackTreeColor color) {
		this.color = color;
	}
}
